tools/xl: Allow callers of `xl info` to select specific information
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 30 Jun 2016 16:40:23 +0000 (17:40 +0100)
committerWei Liu <wei.liu2@citrix.com>
Fri, 8 Jul 2016 13:33:13 +0000 (14:33 +0100)
commit7edc108314486d4dddb9eac92b69f3bc13112527
tree2b5be6b9b66087f76ec6660d90c3795e0a50fdef
parent1e2d167d8faae843b80487e5026b07a135cf4147
tools/xl: Allow callers of `xl info` to select specific information

When scripting, it is much more convenient to use:

    [root@fusebot ~]# xl info xen_version
    4.8-unstable

than to construct some sed/awk/other to parse:

    [root@fusebot ~]# xl info
    ...
    xen_version            : 4.8-unstable
    ...

This works by wrapping all printf() calls in main_info() with maybe_printf(),
which formats its arguments, compares the resulting string to the provided
restriction, and discards it if no match is found.

A restriction like this doesn't make sense in combination with --numa, so is
excluded in that case.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/libxl/xl_cmdimpl.c